package com.helmlabs.grouper.forms.model.field;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class NameValuePair {
	
	private String name;
	private Object value;
	
	public NameValuePair(String name, Object value){
		this.name = name;
		this.value = value;
	}
	
	public NameValuePair(){	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Object getValue() {
		return value;
	}

	public void setValue(Object value) {
		this.value = value;
	}
	
	@Override
	public boolean equals(Object obj){
		if (obj instanceof NameValuePair){
			if (((NameValuePair)obj).getValue().equals(this.getValue())){
				return true;
			}
			else {
				return false;
			}
		} else {
			if (obj instanceof String){
				if (obj==this.value){
					return true;
				}
			}
		}
		
		return false;
	}
	
	public String toString(){
		return "[" + this.name + ":" + this.value + "]";
	}

}
